package com.company;

import java.util.Scanner;

public class L_Member {
    // 用户属性
    private String username;
    private String password;


    public L_Member(String username, String password) {
        this.password = password;
        this.username = username;
    }

    public String getUsername() {
        return this.username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String toString()
    {
        //输出用户信息
        return"用户名："+username+"\n密码："+password;
    }


    public static void main(String[] args) {
        L_Member admin = new L_Member("admin","123456");
        Scanner input = new Scanner(System.in);
        System.out.println("请输入原密码：");

        String pwd = input.next();
        if(admin.getPassword().equals(pwd)) {
            //对用户输入的密码进行验证
            System.out.println("请输入新密码：");
            admin.setPassword(input.next());    //获取用户输入的新密码
        }else{
            System.out.println("输入的密码错误，无法进行修改！");
        }
        System.out.println("----------------用户信息----------------\n"+admin);
    }
}
